include make.debug

ifndef KOGIS_TARGET

all: default

default:
	@export KOGIS_TARGET="default" ; $(MAKE)

clean:
	@export KOGIS_TARGET="default" ; $(MAKE) clean

else 

ifeq "$(KOGIS_TARGET)" "default"

PROGRAM = kogis
CONFIGS = config.h
DIRS = moduly
IMPORTS = moduly/fwwk.o\
					moduly/random.o\
					moduly/osobnik.o\
					moduly/fitness.o\
					moduly/selekcja.o
					 

all: dirs $(PROGRAM) 

dirs:
	@for f in $(DIRS); do (cd $$f && $(MAKE)) done

CC = g++
CPPFLAGS = $(DEBFLAGS)
CFLAGS = -Wall -fopenmp -O3
LDFLAGS = -lm

$(PROGRAM): $(PROGRAM).h $(PROGRAM).cpp $(CONFIGS) $(IMPORTS)
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $(PROGRAM) $(IMPORTS) $(PROGRAM).cpp

clean:
	@for f in $(DIRS); do (cd $$f && $(MAKE) clean) done; rm -rf $(PROGRAM) *.o *~

endif # ifeq "$(KOGIS_TARGET)" "default"


endif # ifdef KOGIS_TARGET
